exports.index = function (req, res) {

    //获取用户请求参数信息
    var bodyParams = req.routeInfo.bodyParams

    //最终结果
    var resultData = {}

    //获取当前用户的订单
    function searchUserOrder(cb) {

        //初始化成交总数
        var buyCount = 0

        //初始化成交总金额
        var buyMoney = 0.0

        R.SEND_HTTP(
            req,
            res,
            {
                url: config.external_server.apiAddress + "/organization/search_art_product_order/apo_status/1/apo_invite_code/" + bodyParams.u_id + "/sort_order/apo_create_time-desc",
                method: 'POST',
                data: {
                    fields: 'apo_real_pay'
                }
            },
            function (data) {

                //计算成交总数 和 成交金额
                buyCount = data.result.data.length;

                for (var i = 0; i < data.result.data.length; i++) {
                    buyMoney += parseFloat(data.result.data[i].apo_real_pay);
                }

                resultData.buyCount = buyCount;
                resultData.buyMoney = buyMoney;

                cb();

            }
        )

    }

    F.Serial([
        searchUserOrder
    ], () => {
        RES.successResponse(res, resultData);
    })


}